package com.heima.article.service.impl;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.heima.article.mapper.ArticleConfigMapper;
import com.heima.article.service.ApArticleConfigService;
import com.heima.model.article.pojos.ApArticleConfig;
import org.springframework.stereotype.Service;

import java.util.Map;
/**
 * @author     ：zhangheng
 * @date       ：Created in 2024/10/12 21:23
 * @description：
 * @modified By：
 * @version:
 */
@Service
public class ApArticleConfigServiceImpl extends ServiceImpl<ArticleConfigMapper, ApArticleConfig> implements ApArticleConfigService {
  @Override
  public void updateByMap(Map map) {
    //0下架 1上架
    Object enable = map.get("enable");
    boolean isDown=true;
    if (enable.equals(1)){
       isDown=false;
    }
    //修改文章配置
    update(Wrappers.<ApArticleConfig>lambdaUpdate().eq(ApArticleConfig::getArticleId,map.get("articleId")).set(ApArticleConfig::getIsDown,isDown));
  }

}

